import XButton from './Button/index.vue'
import UserInfo from './UserInfo/index.vue'
import type { App } from 'vue'

const components: any = {
  XButton,
  UserInfo,
}

function install(Vue: App) {
  const keys = Object.keys(components)
  keys.forEach((name) => {
    const component = components[name]
    Vue.component(component.name || name, component)
  })
}

// 默认导出，支持整体安装
export default {
  install,
}

// 单独导出组件，命名导出
export { XButton, UserInfo }

// 支持单独导入组件的类型
// 使用不同的名称避免冲突
export type { XButton as XButtonType, UserInfo as UserInfoType }
